package com.baitiaojun.common.utils.object;

import com.baitiaojun.common.domain.model.page.PageParam;
import com.baitiaojun.common.domain.model.page.PageSorted;
import com.baitiaojun.common.utils.servlet.ServletUtils;
import com.google.common.collect.Lists;

/**
 * 分页工具类
 */
public class PageUtils {

    public  static final Long PAGE_NUM_DEFAULT_VALUE = 0L;

    public  static final Long PAGE_SIZE_DEFAULT_VALUE = 10L;

    public  static final String PAGE_SORTED_FIELD = "id";

    public static PageParam getPageParam() {
        PageParam pageParam = new PageParam();
        pageParam.setPageNo(PAGE_NUM_DEFAULT_VALUE);
        pageParam.setPageSize(PAGE_SIZE_DEFAULT_VALUE);
        pageParam.setPageSorted(Lists.newArrayList(new PageSorted(PAGE_SORTED_FIELD, PageSorted.ASC)));
        return ServletUtils.getJsonParam(PageParam.class, pageParam);
    }
}
